home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / enqr_25.zip / enquire.txt < prev    next >
Text File  |  1994-05-19  |  8KB  |  172 lines

  1. =======================================================================
  2.  
  3.                             Enquire 2.5
  4.              
  5.              (c)1994 Robert Rothenburg Walking-Owl
  6.  
  7. =======================================================================
  8.  
  9. This software may be used and/or copied by individuals and institutions
  10. so long as this program is neihter modified not sold for profit.  It is
  11. provided "as is" with no warrantees or guarantees of any kind.
  12.  
  13. Enquire allows DOS batch files to be interactive-- a question is shown,
  14. user input accepted and an exit code is returned. With Enquire, you can
  15. ask Yes or No questions, use menus or even input environment variables.
  16.  
  17. For example, I use the following in my AUTOEXEC.BAT file:
  18.  
  19.         Enquire -s -d "Do you want to load ANSI.SYS?"
  20.         If errorlevel 2 devlod c:\bin\ansi.sys
  21.  
  22.            [..]
  23.  
  24.         Enquire -s "Do you want to run Windows?"
  25.         If errorlevel 2 WIN
  26.  
  27. I use the same for a few other drivers in my system.  Rather than up-
  28. grading to DOS 6 or using several boot disks for each configuration,
  29. I can choose to load whatever drivers I need each time. (BTW, "devlod"
  30. is a utility by Jim Kyle from Dr. Dobb's Journal, November 1991, which
  31. loads drivers from the command line rather than maintaining several
  32. CONFIG.SYS files...).
  33.  
  34. Enquire has these modes of interaction:
  35.         
  36.         o Yes or No questions (default)
  37.         o Outputting a message only
  38.         o Returning an ASCII code or number
  39.         o Inputing environment variables
  40.  
  41. The first mode is the simplest and probably the one used most.  The
  42. others are 'frills' added in version 2.5.
  43.  
  44. =======================================================================
  45.                         What the options mean:
  46. =======================================================================
  47.  
  48.  -a             Output is sent to the DOS FastPutChar function (Int 29h)
  49.                 rather than to STDOUT, and is not redirectable.
  50.  
  51.  -c             Clears the keyboard buffer before waiting on a key.
  52.  
  53.  -d             If the user hits a key other than 'y' or'n', or if the wait 
  54.                 times out, Enquire assumes No unless the -d option is used,
  55.                 then Yes is assumed.
  56.  
  57.  -e             By default, Enquire echoes a "Yes" or "No" when a key is
  58.                 pressed.  This option tells Enquire to show only the key
  59.                 pressed.
  60.  
  61.  -f             If no message is given, Enquire will return an error. This
  62.                 option forces Enquire to wait for a response instead.
  63.  
  64.  -h             Help (same as -?).
  65.  
  66.  -i             Initializes all the flags to defaults.  Used to disable
  67.                 most options (except the -t, -y or -n) set in the ENQUIRE
  68.                 variable.
  69.  
  70.  -k             Enquire will accept any key, but assume if it is not a 'y'
  71.                 or 'n' key, it is the default (usu. 'n').  This option tells
  72.                 Enquire to accept only a 'y' or 'n' response.
  73.  
  74.  -l             By default, Enquire reads the response directly from the
  75.                 keyboard.  The -l option tells Enquire to read from STDIN,
  76.                 and hence the user must hit ENTER after the response.
  77.  
  78.  -n             See the -y option.
  79.  
  80.  -q             By default, Enquire echoes a "Yes" or "No" when a key is
  81.                 pressed.  This option tells Enquire to show nothing.
  82.  
  83.  -r             Reverses the exit codes.  By default, Enquire returns a
  84.                 0 for No and 2 for Yes (1 always means an error in usage).
  85.                 The -r options returns 2 for No and 0 for Yes.
  86.  
  87.  -s             The keys expected (Y or N) are shown after the query mess-
  88.                 age, in parenthesis, with the default key capitalized.
  89.  
  90.  -t s           By default, Enquire will wait ten seconds for a response.
  91.                 This option tells Enquire to wait 's' seconds, ie. -t 20
  92.                 (Any value between 0 and 59 is acceptable).
  93.  
  94.  -w             By default, Enquire will wait ten seconds for a response.
  95.                 This option tells Enquire to wait forever.
  96.  
  97.  -x             Instead of returning a 0 or 2 for No or Yes, the ASCII code
  98.                 of the key pressed (lowercase) is returned.
  99.  
  100.  -y "c"         By default, when the 'y' key is pressed, Enquire shows "Yes".
  101.                 This option redefied the Yes key and what is shown instead,
  102.                 ie, -y "Si" for Spanish users accepts 's' as Yes and shows
  103.                 the word "Si".  The -n option works the same for No.
  104.  
  105.  -z             Enquire will not wait for a response, but simple output the
  106.                 message.
  107.  
  108.  -#             Enquire will input a number from the line and return that
  109.                 number as the exit code.
  110.  
  111.  "string"       The is the response string, which should follow all the
  112.                 options.  All the strings must be in double-quotes, and
  113.                 can use most ANSI C escape codes:
  114.         
  115.                         \a      = audible bell (ASCII 07)
  116.                         \b      = backspace
  117.                         \f      = formfeed
  118.                         \n      = newline
  119.                         \r      = carriage return
  120.                         \t      = horizontal tab
  121.                         \v      = vertical tab
  122.                         \nnn    = ASCII code (in decimal)  ie., \254
  123.                         \0nnn   = ASCII code (in octal)         \0324
  124.                         \0xHH   = ASCII code (in hexidecimal)   \0xfe
  125.                         \0bxxx  = ASCII code (in binary)        \0b11111110
  126.  
  127.                 For a full DOS newline, use "\r\n" or "\n\r".
  128.  
  129.                 Note that these codes *are* case sensistive!
  130.  
  131.  ,var           To input an environment variable, follow this after the
  132.                 query string, ie., ENQUIRE "New Path: ",PATH
  133.                 (If you hit ENTER and input a blank line, the variable
  134.                 will be undefined!)
  135.  
  136.                 Here's a nifty trick, though.  Let's say you want to add
  137.                 the directory C:\API to your path:
  138.  
  139.                 Enquire -z $PATH ";C:\\API\r\n" |Enquire -f ,PATH
  140.                                            ^^^
  141.                                 Remember the carriage return!!! 
  142.  
  143.  $var           This outputs an environment variable, ie., ENQUIRE -Z $PATH
  144.                 or ENQUIRE -Z "The Path is: $PATH"
  145.  
  146. =======================================================================
  147.                             Miscellania
  148. =======================================================================
  149.  
  150. It's best to play around with Enquire. Since it doesn't change anything
  151. (unless you use the ,var option) it's safe to play around.  Make sure
  152. you've verified that the options are Ok if you are using Enquire for a
  153. utility that can be damaging if mistakes are made.
  154.  
  155. Take a look at the enclosed batch files with this archive to see some
  156. examples.
  157.  
  158. If you have any requests, comments or bug reports, please e-mail me at
  159. the following address:
  160.  
  161. -+------------------------------------------------------------------+-
  162. Robert Rothenburg Walking-Owl (Freelance Writer/Journeyman Programmer)
  163. From somewhere in the cybernetic ether: <robert.rothenburg@asb.com>
  164. -+------------------------------------------------------------------+-
  165. "Is it a surprise that prisons resemble factories, schools, barracks,
  166.  hospitals, which all resemble prisons?" --Michel Foucault
  167. -+------------------------------------------------------------------+-
  168. I am not a number, I am a PGP-Key: 97BE7067 65AB82F1 13A2E88D 9C31E906
  169. -+------------------------------------------------------------------+-
  170. Finger <rrothenb@ic.sunysb.edu> for Public-Key(s).
  171.  
  172.